UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WXdy130IadYefWCF1WI8DQW4/5unV2atldkY0tIUYbk=' 
WHERE 
  key_id = '9417db7d74245623c1a77aef107925af805eae1782a477c0befbba4429354390' 
  AND (
    token = 'WXdy130IadYefWCF1WI8DQW4/5unV2atldkY0tIUYbk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030