UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GP9JuXwGajmrp50o3eGUHRRbbO55Wk7AF+7sH/98toc=' 
WHERE 
  key_id = '1ce1ff52fac89ab63fa4abc88f738d2eff34aefd71d66521d86ec22abd25c310' 
  AND (
    token = 'GP9JuXwGajmrp50o3eGUHRRbbO55Wk7AF+7sH/98toc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036