UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3T0SeT1hoRRWGWJYJ1ja4oiAW7sOabYx0Pfj3KmD+3o=' 
WHERE 
  key_id = 'fd598c1ced935983225328d91174feae1b4e3447cb12698535d7f6cfd1a89fcb' 
  AND (
    token = '3T0SeT1hoRRWGWJYJ1ja4oiAW7sOabYx0Pfj3KmD+3o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029