UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+uv0xRJRqdI5CBKCs5ehSdBLQFJ5biC66gr4ayKUKAA=' 
WHERE 
  key_id = '65407ff624ed9b7ddd8e30323222887c0a1848a3776529badbe374493f8c401b' 
  AND (
    token = '+uv0xRJRqdI5CBKCs5ehSdBLQFJ5biC66gr4ayKUKAA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026