UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PdOfm/HBe+vSkvIZ+dv3Ng4+wW9FGyspEWuWiHrMfrM=' 
WHERE 
  key_id = '9785648d2d8d8315a879a4817e23daa40ebb18cc5cec544841ed407b42d55f31' 
  AND (
    token = 'PdOfm/HBe+vSkvIZ+dv3Ng4+wW9FGyspEWuWiHrMfrM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063