UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wJETpHsvlMsMnnpCDqaSr3IVUU4XouB7ohK8by+JoGs=' 
WHERE 
  key_id = 'f4766dd95318a9bea34860c49ef2224cbbdc1099bb0b3879d9675f9781353e47' 
  AND (
    token = 'wJETpHsvlMsMnnpCDqaSr3IVUU4XouB7ohK8by+JoGs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048