UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3phGxsd7N1BcqWsH5zf6WavXpBrcX/gy9JlWmC91EzE=' 
WHERE 
  key_id = 'e0d332687aa87e51f7516eccb1b5fd7a4cc4f9e49d71a814a7add09034cc4ba0' 
  AND (
    token = '3phGxsd7N1BcqWsH5zf6WavXpBrcX/gy9JlWmC91EzE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044