UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i5Ctc/KmbqCgZV4HGusq1Cptz+7Xt0xa5XM/RCs5Xrc=' 
WHERE 
  key_id = '6338d6eff1872044b49b4721ffca35c0a11339e814867d95d7e2b9ca40ebe90a' 
  AND (
    token = 'i5Ctc/KmbqCgZV4HGusq1Cptz+7Xt0xa5XM/RCs5Xrc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034