UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VSXiWybM9VbVF6u3mlN0s7gzzS1werYqePNC9+eHXIw=' 
WHERE 
  key_id = 'e392739a7fe1f607261930058da480c0f459619645f4ab73ef3b467a712eb93c' 
  AND (
    token = 'VSXiWybM9VbVF6u3mlN0s7gzzS1werYqePNC9+eHXIw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026