UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IOD2VXtrJkWHC5AgEEfA4XD9xzhYaAkv17VBr2+ZE9g=' 
WHERE 
  key_id = 'be18723a2fb129ab06c3de9977c38b4218f17f8f3d02782665c4db0dab9d2734' 
  AND (
    token = 'IOD2VXtrJkWHC5AgEEfA4XD9xzhYaAkv17VBr2+ZE9g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032