UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A8bDFgqhcKclqsuTUQdW0ScPUX6vh+rrE7nIDZX6AN0=' 
WHERE 
  key_id = '2ae4f8be55f397c398b6b01f9e66d686676aa999875c17a73366f4a54c9cc697' 
  AND (
    token = 'A8bDFgqhcKclqsuTUQdW0ScPUX6vh+rrE7nIDZX6AN0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019