UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F7Nv9ubm8+DwvwENA0lLZyKnPPGbvaZ0CDlyhQtXmzY=' 
WHERE 
  key_id = '5762cf097b0aa2b98fdeb88a192c118c0a4363edfbbfa76285f211c4c9d6733f' 
  AND (
    token = 'F7Nv9ubm8+DwvwENA0lLZyKnPPGbvaZ0CDlyhQtXmzY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033