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

Query time 0.00032