UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'txwgh8OcmDYFRT0fy18pIkFHSA9KrGwLP+OopRlXxvc=' 
WHERE 
  key_id = '9e1baa4802fd1de7856e9b80b6c3356063be004959999d90ced129029c3ae3b3' 
  AND (
    token = 'txwgh8OcmDYFRT0fy18pIkFHSA9KrGwLP+OopRlXxvc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027