UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lfQtmedtjrigmgqp9wcSAtaDsvkP1CD0bwsL+1czSys=' 
WHERE 
  key_id = '8c891de21c607244551abe60226097835b28699183d230151ef4e6258f12cb66' 
  AND (
    token = 'lfQtmedtjrigmgqp9wcSAtaDsvkP1CD0bwsL+1czSys=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033