UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K6W6RxssPqRYStsxp3bLOSyV2TifYn4UnDVTxSDHPmU=' 
WHERE 
  key_id = 'e8cb0cdcc82826124faab113f4cd18e9685575574b056c7813c886e447b9d879' 
  AND (
    token = 'K6W6RxssPqRYStsxp3bLOSyV2TifYn4UnDVTxSDHPmU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060