UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S/wjWIu6Ug4e+9QS5qcar7SaTaxGzZO3mwDjawwyxL8=' 
WHERE 
  key_id = 'bca8776ca73a9dbb67ea4330e814de40e216c51b772ce80e72ccd159d27da40d' 
  AND (
    token = 'S/wjWIu6Ug4e+9QS5qcar7SaTaxGzZO3mwDjawwyxL8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034