UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QieOQfxoeFvjTWp3MBNtJ3tfgduTpQ9j+ss+zXnui/I=' 
WHERE 
  key_id = '25612bdfa833e14684c363fd51fbd63650d22cb3dc5df20629a9cae8ca77d025' 
  AND (
    token = 'QieOQfxoeFvjTWp3MBNtJ3tfgduTpQ9j+ss+zXnui/I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041