UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mw3U4CvVqiYTjteuKVm4U2VAk6tIddwCEOdX0V+US6U=' 
WHERE 
  key_id = '8189b8c029cc10320fd5e5ca4bac24fedffb933b6669f5232881941282b0b67f' 
  AND (
    token = 'Mw3U4CvVqiYTjteuKVm4U2VAk6tIddwCEOdX0V+US6U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023