UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8jYIthSfSm1IusbRHL+TNIcxgoMTHwIlnVQ0p7ihzu0=' 
WHERE 
  key_id = '4a8159d4c8fedccb3a9e8af0710db833194068625ce2753457ca92b69e3dc1bc' 
  AND (
    token = '8jYIthSfSm1IusbRHL+TNIcxgoMTHwIlnVQ0p7ihzu0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037