UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7ckc9ryK4dUq0u4+6yFWq+3TNjd4EvxD+huV1GtKwQ0=' 
WHERE 
  key_id = '9b6b863b14cca3a855c881850b0700922c5cae14963929a57860389280df581c' 
  AND (
    token = '7ckc9ryK4dUq0u4+6yFWq+3TNjd4EvxD+huV1GtKwQ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052