UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T8vO7YNzJEb01X4IM/vJFRlwjuDLbQkgcm4Thk+4t/A=' 
WHERE 
  key_id = 'a7651ecbd4d38d45a82065b55f0009d720c55a7b7cf10603eb17c949cc5032d1' 
  AND (
    token = 'T8vO7YNzJEb01X4IM/vJFRlwjuDLbQkgcm4Thk+4t/A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032