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

Query time 0.00031