UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+iRCFMDqb4ugQWwpVgqP+ZWNxDHbusJnt4vC4hd63Hc=' 
WHERE 
  key_id = 'b65ce08910b64bc7f55c14f936f0110af323e9f2e5c627c19977d02da397ac92' 
  AND (
    token = '+iRCFMDqb4ugQWwpVgqP+ZWNxDHbusJnt4vC4hd63Hc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032