UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Th7bu9KtKG3T+25QB9Eb2dmU5x7XCkxZ4UCRuWsc25A=' 
WHERE 
  key_id = '0a7e9577b5016630a66db26367cb998d526b541e90e589830a79e5f0a0603c56' 
  AND (
    token = 'Th7bu9KtKG3T+25QB9Eb2dmU5x7XCkxZ4UCRuWsc25A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031