UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+bRAgrSkG6O0ZWY9t1bjReptuylyDSWxBwDjy15SeF8=' 
WHERE 
  key_id = '2547328dcb8d5b3f1aeae430a40b54a659eb4cd5aa8541f7577e0a7fb4bfa630' 
  AND (
    token = '+bRAgrSkG6O0ZWY9t1bjReptuylyDSWxBwDjy15SeF8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024