UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xN2YzkYMhLSXAV+U77qIs1F8IoEm7AWJ8hf/SoG10Aw=' 
WHERE 
  key_id = '89423878e0cfd9d89a9bb74e8847da30709198ed68027780100422b7f2e3b206' 
  AND (
    token = 'xN2YzkYMhLSXAV+U77qIs1F8IoEm7AWJ8hf/SoG10Aw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031