UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yfLCcR0iSN3o8+/tQ6IHq36c61UHPwVeuMRWfxWkWt8=' 
WHERE 
  key_id = '2948ddffaaec78d7856228c2c6f7f433063f9a730aac8c0c013ad81bb9930d07' 
  AND (
    token = 'yfLCcR0iSN3o8+/tQ6IHq36c61UHPwVeuMRWfxWkWt8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033