UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RpQ8HGgQnXLd33hHqzO2QwV12a8CHhbUI2p9qqwXb1o=' 
WHERE 
  key_id = 'a3c0d5daa1a365ad77773603cbfff7b40a86bfea0cd06b290cd494dc45f36e2b' 
  AND (
    token = 'RpQ8HGgQnXLd33hHqzO2QwV12a8CHhbUI2p9qqwXb1o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026