UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oHv91FPkWYGYrrL5bryxgl4Ife22Pgnd+vHhDqREUo8=' 
WHERE 
  key_id = '2651be4351ddd177b7a8aad6a7ea8fb4291f4c8de702c8421de9fdde908e9b87' 
  AND (
    token = 'oHv91FPkWYGYrrL5bryxgl4Ife22Pgnd+vHhDqREUo8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032