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

Query time 0.00052