UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f36RDKJza6jgYW1m81l6va4oLj9iEfagziy5RyBKX+c=' 
WHERE 
  key_id = '216050d15bf65779efc6a64c96081d8b8d4348dbcb7553dc1cb468257c293545' 
  AND (
    token = 'f36RDKJza6jgYW1m81l6va4oLj9iEfagziy5RyBKX+c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033