UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6xMDv1u4u2G0OYD2nCd6zPWO3lQGA9oFKCJ+3ob2zps=' 
WHERE 
  key_id = '7c63093edbf78f33c5e4954e2c7c5a499900b5df41192e0f7c2351cf4f1bcfae' 
  AND (
    token = '6xMDv1u4u2G0OYD2nCd6zPWO3lQGA9oFKCJ+3ob2zps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032