UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K6tqguo2uYiwSwBp78A8tsY6EE/P8SEt+w9t922F6KI=' 
WHERE 
  key_id = '5c752f39ce644455645d2e28aed8a5500c5f9dd51a1e41d4a93e475ccdcd389c' 
  AND (
    token = 'K6tqguo2uYiwSwBp78A8tsY6EE/P8SEt+w9t922F6KI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042