UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BflVoaR4FnZlDwBXwzQWeupCT5GyIez4RmrYPJItxAA=' 
WHERE 
  key_id = '7933514d34af16a50bfe3b789cadd5bef94692e04d5322034e94bffb9bb787a2' 
  AND (
    token = 'BflVoaR4FnZlDwBXwzQWeupCT5GyIez4RmrYPJItxAA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032