UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6n/JVKx2d8W0yMRYfsbcK6OeRDARVOBvEivf7SeKN30=' 
WHERE 
  key_id = '4ea6a933b9eda4a395a8b0c75e08e40d555a9dd8a8d010d7e0e790789c29609f' 
  AND (
    token = '6n/JVKx2d8W0yMRYfsbcK6OeRDARVOBvEivf7SeKN30=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016